#coding=utf-8

import os
import logging
import wsgiref.handlers
import tornado.wsgi
from app.controllers import *

LOGGING_LEVEL = logging.WARN

settings = {
    "template_path": os.path.join(os.path.dirname(__file__), "templates"),
    "ui_modules": {},
    "xsrf_cookies": True,
    "debug": os.environ['SERVER_SOFTWARE'].startswith('Dev'),
}

url_mappings = [
    (r"/",                       HomeController),
    (r"/cal",                    CalController)
]

application = tornado.wsgi.WSGIApplication(url_mappings, **settings)

def main():
    logging.getLogger().setLevel(LOGGING_LEVEL)
    wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
    main()